package edu.study.common.util;

import java.util.Random;
import java.util.UUID;

public class UUIDUtil {
    /**
     * 获取随机UUID，无-符号
     *
     * @return
     */
    public static String getRandomUuid() {
        return UUID.randomUUID().toString().replace("-", "");
    }

    //private static KeyGenerator keyGenerator = new IPKeyGenerator();

    private static Random random = new Random();

    private static final int MAX_SEQUENCE = 128;

    private static final long SEQUENCE_BITS = 12L;

    public static String getUUID() {
        return UUID.randomUUID().toString();
    }

    public static String get32UUID() {
        return getUUID().replace("-", "").toUpperCase();
    }


    /*public static String getId() {
        long id = (keyGenerator.generateKey().longValue() >> SEQUENCE_BITS << SEQUENCE_BITS) | random.nextInt(MAX_SEQUENCE);
        return String.valueOf(id);
    }*/
}
